<template>
    <div>
        <ul>
            <li v-for="(data, index) in datalist" :key="data" @click="handleClick">
                {{ data }}
            </li>
        </ul>
    </div>
</template>
<script>
import { inject, ref } from 'vue';

export default {
    setup() {
        const datalist = ref(["aaa", "bbb", "ccc"])

        const which = inject("which")

        const handleClick = () => {
            //将父组件的which改为Detail
            which.value = "Detail"
        }

        return {
            datalist,
            handleClick
        }
    },
}
</script>